package cn.memorynine.consumer.controller;

import cn.memorynine.consumer.model.personal.activity.ActivityListParam;
import cn.memorynine.consumer.model.personal.address.*;
import cn.memorynine.consumer.model.personal.cart.CartItemListParam;
import cn.memorynine.consumer.model.personal.cart.CartItemQuantityParam;
import cn.memorynine.consumer.model.personal.cart.DelCartItemParam;
import cn.memorynine.consumer.model.personal.center.*;
import cn.memorynine.consumer.model.personal.donation.DonationListParam;
import cn.memorynine.consumer.model.personal.forum.DelPostParam;
import cn.memorynine.consumer.model.personal.forum.PostListParam;
import cn.memorynine.consumer.model.personal.forum.ReplyListParam;
import cn.memorynine.consumer.model.personal.order.OrderInfoParam;
import cn.memorynine.consumer.model.personal.order.OrderListParam;
import cn.memorynine.consumer.model.personal.order.OrderStateListParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import cn.memorynine.common.model.ResponseWrapper;
import cn.memorynine.consumer.service.PersonalCenterService;
import cn.memorynine.common.model.ResponseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;

/**
* 个人中心-个人信息管理控制器
* @author 代码生成器
*/
@Slf4j
@RestController
@RequestMapping("/personalCenter")
public class PersonalCenterController {
    @Autowired
    private PersonalCenterService personalCenterService;

    /**
     * 1.获取个人信息
     * @return
     */
    @RequestMapping("/personalInfo")
    public ResponseWrapper personalInfo(@RequestBody @Validated PersonalInfoParam param){
        return personalCenterService.personalInfo(param);
    }

    /**
     * 2.修改个人信息
     * @return
     */
    @RequestMapping("/savePersonalInfo")
    public ResponseWrapper savePersonalInfo(@RequestBody @Validated SavePersonalInfoParam param){
        return personalCenterService.savePersonalInfo(param);
    }

    /**
     * 3.修改密码
     * @return
     */
    @RequestMapping("/saveLoginKey")
    public ResponseWrapper saveLoginKey(@RequestBody @Validated SaveLoginKeyParam param){
        return personalCenterService.saveLoginKey(param);
    }

    /**
     * 1.查看购物车内商品列表
     * @return
     */
    @RequestMapping("/cartItemList")
    public ResponseWrapper cartItemList(@RequestBody @Validated CartItemListParam param){
        return personalCenterService.cartItemList(param);
    }

    /**
     * 2.删除购物车项
     * @return
     */
    @RequestMapping("/delCartItem")
    public ResponseWrapper delCartItem(@RequestBody @Validated DelCartItemParam param){
        return personalCenterService.delCartItem(param);
    }

    /**
     * 3.修改商品数量
     * @return
     */
    @RequestMapping("/cartItemQuantity")
    public ResponseWrapper cartItemQuantity(@RequestBody @Validated CartItemQuantityParam param){
        return personalCenterService.cartItemQuantity(param);
    }

    /**
     * 地址管理部分
     */
    /**
     * 1.获取当前用户的所有地址列表
     */
    @RequestMapping("/addressList")
    public ResponseWrapper addressList(@RequestBody @Validated AddressListParam param){
        return personalCenterService.addressList(param);
    }
    /**
     * 2.新增/修改地址--获取地址详情
     */
    @RequestMapping("/addressInfo")
    public ResponseWrapper addressInfo(@RequestBody @Validated AddressInfoParam param){
        return personalCenterService.addressInfo(param);
    }
    /**
     * 3.新增/修改地址
     */
    @RequestMapping("/saveAddress")
    public ResponseWrapper saveAddress(@RequestBody @Validated SaveAddressParam param){
        return personalCenterService.saveAddress(param);
    }
    /**
     * 4.删除地址
     */
    @RequestMapping("/delAddress")
    public ResponseWrapper delAddress(@RequestBody @Validated DelAddressParam param){
        return personalCenterService.delAddress(param);
    }

    /**
     * 5.设置默认地址
     */
    @RequestMapping("/defaultAddress")
    public ResponseWrapper defaultAddress(@RequestBody @Validated DefaultAddressParam param){
        return personalCenterService.defaultAddress(param);
    }

    /**
     * 订单部分
     */
    /**
     * 1.查看当前用户所有订单
     * @return
     */
    @RequestMapping("/orderList")
    public ResponseWrapper orderList(@RequestBody @Validated OrderListParam param){
        return personalCenterService.orderList(param);
    }
    /**
     * 2.查看订单详情
     * @return
     */
    @RequestMapping("/orderInfo")
    public ResponseWrapper orderInfo(@RequestBody @Validated OrderInfoParam param){
        return personalCenterService.orderInfo(param);
    }
    /**
     * 3.获取订单状态列表
     * @return
     */
    @RequestMapping("/orderStateList")
    public ResponseWrapper orderStateList(@RequestBody @Validated OrderStateListParam param){
        return personalCenterService.orderStateList(param);
    }

    /**
     * 活动部分
     */
    /**
     * 1.查看用户参与的活动列表
     * @return
     */
    @RequestMapping("/activityList")
    public ResponseWrapper activityList(@RequestBody @Validated ActivityListParam param){
        return personalCenterService.activityList(param);
    }

    /**
     * 论坛部分
     */
    /**
     * 1.获取当前用户的全部帖子列表
     * @return
     */
    @RequestMapping("/postList")
    public ResponseWrapper postList(@RequestBody @Validated PostListParam param){
        return personalCenterService.postList(param);
    }

    /**
     * 2.删除帖子
     * @return
     */
    @RequestMapping("/delPost")
    public ResponseWrapper delPost(@RequestBody @Validated DelPostParam param){
        return personalCenterService.delPost(param);
    }

    /**
     * 3.获取当前用户所有回复列表
     * @return
     */
    @RequestMapping("/replyList")
    public ResponseWrapper replyList(@RequestBody @Validated ReplyListParam param){
        return personalCenterService.replyList(param);
    }

    /**
     * 捐赠部分
     */
    /**
     * 1.查看当前用户全部捐赠记录
     * @return
     */
    @RequestMapping("/donationList")
    public ResponseWrapper donationList(@RequestBody @Validated DonationListParam param){
        return personalCenterService.donationList(param);
    }
}